{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "82097cee-fd51-4a22-9970-074e24324755",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/linked-list-cycle-ii\n",
    "\n",
    "\n",
    "Runtime: 56 ms, faster than 8.10% of Go online submissions for Linked List Cycle II.\n",
    "Memory Usage: 4.8 MB, less than 28.35% of Go online submissions for Linked List Cycle II.\n",
    "\n",
    "\n",
    "```go\n",
    "func detectCycle(head *ListNode) *ListNode {\n",
    "\t//6:36\n",
    "\tok := false\n",
    "\tl := make([]*ListNode, 0)\n",
    "\tindex := 0\n",
    "\tnode := head\n",
    "\tfor node != nil {\n",
    "\t\tok = false\n",
    "\t\tfor _, n := range l {\n",
    "\t\t\tif n == node {\n",
    "\t\t\t\tok = true\n",
    "\t\t\t\tbreak\n",
    "\t\t\t}\n",
    "\t\t}\n",
    "\t\tl = append(l, node)\n",
    "\t\tif ok {\n",
    "\t\t\treturn l[index]\n",
    "\t\t}\n",
    "\t\tnode = node.Next\n",
    "\t\tindex += 1\n",
    "\t}\n",
    "\treturn nil\n",
    "\t//6:38\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d702ba02-d4e5-40cb-9e52-67b3510e5c48",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go",
   "language": "go",
   "name": "gophernotes"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.14.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
